import { createWebHistory, createRouter } from 'vue-router'

import About from "../pages/about.vue";
import Home from "../pages/home.vue";
import Media from "@/pages/media/index.vue";
import Upload from "@/pages/uploadFile.vue";
import Blog from "@/pages/file/index.vue";
import ShowFile from "@/pages/file/showFile.vue";


const routes = [
    { path: '/',
        components: {
            topBar:()=>import("@/topBar/default.vue"),
            main:Home
        }
    },
    { path: '/file',
        children:[
            {
                path:"",
                components:{
                    topBar:()=>import("@/topBar/default.vue"),
                    main:()=>import("@/pages/file/index.vue")
                }
            },
            {
                path:"article",
                components: {
                    topBar:()=>import("@/topBar/default.vue"),
                    main:()=>import("@/pages/file/showFile.vue")
                }
            }
        ]
    },
    { path: '/about',
        components: {
            main:About
        }
    },
    {
        path: '/media',
        children: [
            {
                path: '',
                components: {
                    main:Media
                }
            },
            { path: 'show', components: {main: () => import("@/pages/media/showFile.vue")}},
        ]
    },
    { path: '/tool',children: [
        { path: '', components: {main:()=> import("@/pages/tools/index.vue")} },
        { path: 'showFile', components: {main: () => import("@/pages/tools/showFile.vue")} }
    ]},
    { path: '/upload', components: {main:Upload} },
    { path: '/:pathMatch(.*)*',
        components: {main: () => import("@/pages/Empty.vue")}
    },
]

const router = createRouter({
    history: createWebHistory(),
    routes,
})

export default router;